package com.dexilaonian.adpter;

import android.content.Context;
import android.support.v4.app.FragmentActivity;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.dexilaonian.R;
import com.dexilaonian.ui.MyRecyclerViewOnclickInterface;

import java.util.ArrayList;

/**
 * Created by Administrator on 2018/3/23.
 */

public class PersonAdapter extends RecyclerView.Adapter<PersonAdapter.MyViewHolde>{

    private final Context mContext;
    private final ArrayList<String> mList_person;

    public MyRecyclerViewOnclickInterface mOnItemClickLitener;

    public void setmOnItemClickLitener(MyRecyclerViewOnclickInterface mOnItemClickLitener) {
        this.mOnItemClickLitener = mOnItemClickLitener;
    }

    public PersonAdapter(Context context, ArrayList<String> list_person) {
        mContext = context;
        mList_person = list_person;
    }


    @Override
    public PersonAdapter.MyViewHolde onCreateViewHolder(ViewGroup parent, int viewType) {
        LayoutInflater inflater = LayoutInflater.from(mContext);
        MyViewHolde myViewHolde = new MyViewHolde(inflater.inflate(R.layout.recyclerview_item_person, parent, false));
        return myViewHolde;
    }

    @Override
    public void onBindViewHolder(PersonAdapter.MyViewHolde holder, int position) {
   /*     holder.tvTitleHouse.setText(mList_person.get(position));
        holder.tvminHouse.setText(mList_person.get(position));
        holder.tvTitleHouse.setText(mList_person.get(position));
        holder.tvHouseMoney.setText(mList_person.get(position));*/
        // ImageLoader.display(context,new_url,holder.houseTime);
       /* if (mOnItemClickLitener != null) {
            holder.tvItem.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    int layoutPosition = holder.getLayoutPosition();
                    mOnItemClickLitener.onItemClick(holder.tvItem, layoutPosition);
                }
            });*/
      //  }
    }

    @Override
    public int getItemCount() {
        return mList_person.size();
    }

   class MyViewHolde extends RecyclerView.ViewHolder{


        TextView tvTitleHouse;
       TextView tvminHouse;
       TextView ivTitleHouse;
       ImageView houseTime;
       TextView tvHouseMoney;

       public MyViewHolde(View itemView) {
           super(itemView);
           tvTitleHouse = (TextView) itemView.findViewById(R.id.tv_title_hosue);
           tvminHouse = (TextView) itemView.findViewById(R.id.tv_min_house);
           ivTitleHouse = (TextView) itemView.findViewById(R.id.tv_min_house);
           houseTime = (ImageView) itemView.findViewById(R.id.iv_time);
           tvHouseMoney = (TextView) itemView.findViewById(R.id.house_money);
       }
   }
}
